//
//  HeroViewController.m
//  A_HandHeldLOL
//
//  Created by Zhao YanBin on 16/1/16.
//  Copyright © 2016年 zhaoyanbin. All rights reserved.
//

#import "HeroViewController.h"
#import "ZhuceViewController.h"
#import "DengluViewController.h"
@interface HeroViewController ()<UITableViewDataSource, UITableViewDelegate>
@property(nonatomic, retain)UITableView *tableView;
@property(nonatomic, retain)UIView *header;
@property(nonatomic, retain)NSArray *arr;


@property(nonatomic, retain)UIImageView *img;
@property(nonatomic, retain)UIButton *denglu;
@property(nonatomic, retain)UIButton *zhuce;
@property(nonatomic, retain)UILabel *weidenglu;
@end

@implementation HeroViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self creatableView];
}

//创建tableView
-(void)creatableView
{
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    [self.view addSubview:_tableView];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
    [_tableView release];
    
    self.header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];
    self.header.backgroundColor = [UIColor yellowColor];
    _tableView.tableHeaderView = _header;
    [self.tableView addSubview:_header];
    
    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    
    
    [self data];
    
    [self head];
}

-(void)head
{
    self.img = [[UIImageView alloc] init];
    _img.frame = CGRectMake(0, 0, 100, 100);
//    _img.backgroundColor = [UIColor blackColor];
    _img.image = [UIImage imageNamed:@"denglu"];
    _img.center = CGPointMake(self.view.center.x, self.header.center.y);
    _img.layer.cornerRadius = 50;
    _img.clipsToBounds = YES;
    [self.header addSubview:_img];
    [_img release];
    
    self.denglu = [UIButton buttonWithType:UIButtonTypeSystem];
    _denglu.frame = CGRectMake(120, 160, 60, 30);
    _denglu.backgroundColor = [UIColor blueColor];
    [_denglu setTitle:@"登录" forState:UIControlStateNormal];
    [_denglu addTarget:self action:@selector(denglu:) forControlEvents:UIControlEventTouchUpInside];
    [self.header addSubview:_denglu];
    
    self.zhuce = [UIButton buttonWithType:UIButtonTypeSystem];
    _zhuce.frame = CGRectMake(200, 160, 60, 30);
    _zhuce.backgroundColor = [UIColor blueColor];
    [_zhuce addTarget:self action:@selector(zhuce:) forControlEvents:UIControlEventTouchUpInside];
    [_zhuce setTitle:@"注册" forState:UIControlStateNormal];
    [self.header addSubview:_zhuce];

    
}

//登录点击
-(void)denglu:(UIButton *)btn
{
    DengluViewController *dlVC = [[DengluViewController alloc] init];
    UINavigationController *zhuceNC = [[UINavigationController alloc] initWithRootViewController:dlVC];
    [self presentViewController:zhuceNC animated:YES completion:^{
        
    }];
}



//注册点击
-(void)zhuce:(UIButton *)btn
{
    ZhuceViewController *zcVC = [[ZhuceViewController alloc] init];
    [self.navigationController pushViewController:zcVC animated:YES];
}

-(void)data
{
    self.arr = @[@"账号信息", @"我的收藏", @"意见反馈", @"设置"];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _arr.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.textLabel.text = _arr[indexPath.row];
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
